package com.longshine.plc.ui;

import com.longshine.plc.net.ServerService;
import com.longshine.util.CommonUtil;

class StartServerThread extends Thread
{
  ServerService ss;
  int port;
  private boolean result = false;
  private boolean isComp = false;

  public boolean isIsComp()
  {
    return this.isComp;
  }

  public void setIsComp(boolean isComp) {
    this.isComp = isComp;
  }

  public boolean isResult() {
    return this.result;
  }

  public void setResult(boolean result) {
    this.result = result;
  }

  public StartServerThread(ServerService ss, int port)
  {
    this.ss = ss;
    this.port = port;
  }
  public void run() {
    try {
      if (this.ss == null) return;
      this.result = true;
      this.ss.startServer(this.port);
    } catch (Exception ex) {
      this.result = false;
    }
    this.isComp = true;
  }

  public boolean isStartSuc() {
    CommonUtil.delay(1000L);
    return this.result;
  }
}